Fix Update Dependencies failing when two jobs push to main at once - #584
Draft
cratis-stagehand[bot] wants to merge 1 commit into
Draft
Fix Update Dependencies failing when two jobs push to main at once#584cratis-stagehand[bot] wants to merge 1 commit into
cratis-stagehand[bot] wants to merge 1 commit into
Conversation
The dependency update jobs commit straight to main from several jobs at once, so a push rejected with "cannot lock ref 'refs/heads/main'" means another job simply moved the branch first. Rebase onto the new remote head and try again rather than treating it as a failure.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Important
This branch is incomplete and must not be merged as-is. The accompanying commit to
.github/workflows/update-dependencies.ymlcould not be pushed — the bot account (cratis-stagehand[bot]) has noworkflowspermission, so bothgit pushand the contents API reject it:The exact patch is in the comment on #582. Someone with
workflowspermission needs to apply it to this branch, after which the PR is complete and can be marked ready.Summary
"Update Dependencies" has failed on and off for weeks — 5 of the last 15 runs, most recently run 33171239370. The dependency updates were never the problem. The three
update-npmmatrix jobs run in parallel and each commits and pushes straight tomain, so whichever pushes second loses the race:fail-fastthen cancelled the sibling jobs, so a single lost race took the whole run down and silently dropped the bumps the cancelled jobs had already computed. Every one of the recent failures is this same rejected push.Fixed
mainat the same time (The "Update Dependencies" GitHub Actions workflow in Cratis/Samples is failing (https://github.com/Cratis/Samples/act... #582)Changed
Verification
The race and the fix were reproduced end to end locally against real git repositories, using depth-1 clones to mirror
actions/checkout@v4:git pull --rebase && git pushis rejected withfailed to push some refs. Same failure mode as the CI run.push-with-retry.shis rejected on attempt 1, rebases onto the new head, and succeeds on attempt 2. Both folders' updates end up on the remote; neither is lost.::error::annotation, so a genuine push problem is not swallowed by the retry.Repository gates on this branch:
dotnet build Samples.slnx -c Debug— 0 errors (18 warnings, all pre-existing onmain; this PR touches no C#)dotnet build Samples.slnx -c Release -p:CratisProxiesOutputPath=— 0 errorsThis also disproves the original hypothesis on #582 that a dependency update had broken the build or tests:
mainbuilds and tests clean at the current package versions.Not verified
LibraryTestcontainers specs were not run — they need Docker, which is unavailable in this environment. CI excludes them from its spec set for the same reason.